﻿@model ApplicationPackageEditDto
@Html.Extra()
@{
    Layout = "~/Views/Shared/OA/_Edit.cshtml";

    Model.Type = "Role";
}
@section Toolbar
{
    @Html.MyNet().Button(new ButtonOptions { Text = "保存", Click = "save" })
    @Html.MyNet().Button(new ButtonOptions { Text = "返回", Click = "back" })
}
@section Main
{
    @Html.HiddenFor(model => model.Type)
    @Html.HiddenFor(model => model.ApplicationId)
    <table>
        <tr>
            <th>
                @Html.LabelFor(model => model.TargetIds, "选择角色")
            </th>
            <td>
                @Html.MyNet().CheckBoxListFor(model => model.TargetIds, Url.Action("Read", "Role"), "Id", "Name", InputValueType.Array)
            </td>
        </tr>
    </table>
}
<script>

    function save()
    {
        var form = $("form");
        if (!form.valid()) return;

        $.ajax
        ({
            url: form.attr("action"),
            data: form.serialize(),
            type: "post",
            error: disposeError,
            success: function (result)
            {
                if (disposeException(result)) return;
                back(true);
            }
        });
    }

</script>
